package simulator;

class Memory{
	
	static int[] space; //memory space
	int flag; 
	/*shows W/R condition
	 * 0: Disabled
	 * 1: Write
	 * 2: Read
	 * 3: Error
	*/
	
	Memory()
	{
		space = new int[4096];
	}
	
	public void read(int addr){
		MDR = space[addr]; //according the address return data
	}
	
	public void write (){
		
		space[MAR] = MDR; //write data to specific space of memory pointed by addr
	}
	
	public void SetMAR( int val )
	{
		MAR = val;
	}
	public void SetMDR( int val)
	{
		MDR = val;
	}
	public int GetMDR( )
	{
		return MDR;
	}
	public int MDR, MAR;
	
}